package com.atguigu.chapter18.generic

/**
 *
 * @description: xxx
 * @time: 2020-06-02 15:20
 * @author: baojinlong 
 **/
object GenericDemo02 {
  def main(args: Array[String]): Unit = {
    //使用
    val class01 = new EnglishClass[SeasonEnum.Value, String, String](SeasonEnum.SPRING, "0705班", "高级班")
    println("class01 " + class01.classSeason + " " + class01.className + class01.classType)

    val class02 = new EnglishClass[SeasonEnum.Value, String, Int](SeasonEnum.SUMMER, "0707班", 1)

    println("class02 " + class02.classSeason + " " + class02.className + class02.classType)
  }
}


/*
Scala泛型应用案例2

要求
请设计一个EnglishClass (英语班级类)，在创建EnglishClass的一个实例时，需要指定[ 班级开班季节(spring,autumn,summer,winter)、班级名称、班级类型]
开班季节只能是指定的，班级名称为String, 班级类型是(字符串类型 "高级班", "初级班"..) 或者是 Int 类型(1, 2, 3 等)
请使用泛型来完成本案例.

 */
class EnglishClass[A, B, C](val classSeason: A, val className: B, val classType: C)

//季节是枚举类型
object SeasonEnum extends Enumeration {
  val SPRING: SeasonEnum.Value = Value("春天")
  val AUTUMN: SeasonEnum.Value = Value("秋天")
  val SUMMER: SeasonEnum.Value = Value("夏天")
  val WINER: SeasonEnum.Value = Value("冬天")
}

